using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;

using Chess;

namespace PDAChess
{
    public partial class ucGameOption: UserControl
    {
        public delegate void Cancel_Click();
        public event Cancel_Click CancelClick;

        public delegate void Create_Click();
        public event Create_Click CreateClick;

        private GameOption _options;

        public GameOption Options
        {
            get { return _options; }
            set { _options = value; }
        }

        public ucGameOption()
        {
            _options = new GameOption();

            InitializeComponent();

            cbBlack.SelectedIndex = 0;
            cbWhite.SelectedIndex = 0;
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            if (CancelClick != null)
            {
                CancelClick();
            }
        }

        private void btnCreate_Click(object sender, EventArgs e)
        {
            _options.Chess = ChessType.ChineseChess;

            if(rbKing.Checked)
                _options.Chess = ChessType.KingChess;

            _options.Black = Competitor.Human;
            if (cbBlack.Text.Equals("Computer"))
            {
                _options.Black = Competitor.Computer;
            }

            _options.White = Competitor.Human;
            if (cbWhite.Text.Equals("Computer"))
            {
                _options.White = Competitor.Computer;
            }
            
            if (CreateClick != null)
            {
                CreateClick();
            }
        }
    }
}
